{extend name="base" /}
{block name="content"}

<blockquote class="layui-elem-quote">
    苏州公交实时查询信息（仅供参考）
</blockquote>

<fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
    <legend>苏州公交实时查询信息（仅供参考）</legend>
</fieldset>
<div id="content">
    <form class="layui-form layui-form-pane" action="" id="form">
        <div class="layui-form-item">
            <label class="layui-form-label" style="width: 20%;">线路:</label>
            <div style="width: 50%;float: left;">
                <input type="text" name="linename" lay-verify="required" placeholder="线路名称，例：快线1, 55" autocomplete="off" class="layui-input" value="">
                <input type="hidden" id="token" name="__hash__" value="__token__" />
            </div>
            <div style="float: left">
                <button class="layui-btn" lay-submit="" lay-filter="demo1" id="submit">搜索</button>
            </div>
        </div>
    </form>
</div>
<div id="msg">
    {$html|raw}
</div>
{/block}
{block name="js"}
<script src="http://cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script>
<script>
    layui.use(['form','jquery'], function(){
        var $ = layui.jquery, form = layui.form(),layer = layui.layer;
        //监听提交
        form.on('submit(demo1)', function(data){
            /*layer.alert(JSON.stringify(data.field), {
                title: '最终的提交信息'
            });*/
            var url = "/bus/getList";
            //{linename: $('input[name="linename"]').val()}
            $.post(url, data.field, function (data) {
                if (data.code === 200) {
                    $('#msg').html(data.result);
                }
            });
            return false;
        });
    });

    function changeDo(obj) {
        var href = $(obj).data('href');
        location.href = '/bus/line?url=' + href;
    }

</script>
{/block}